﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UTable.Core.Diagnostics
{
    public static class Time
    {
        private static DateTime UTableSystemTime = new DateTime(2012, 12, 1);

        public static long GetTimestamp(DateTime dateTime)
        {
            TimeSpan ts = dateTime - TimeZone.CurrentTimeZone.ToLocalTime(UTableSystemTime);
            return (long)Convert.ToUInt64(ts.TotalMilliseconds);
        }

        public static long GetTimestamp()
        {
            TimeSpan ts = DateTime.Now - TimeZone.CurrentTimeZone.ToLocalTime(UTableSystemTime);
            return (long)Convert.ToUInt64(ts.TotalMilliseconds);
        }
    }
}
